﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CFSystem.JXC.BLL;
using CFSystem.JXC.Model;
using CFSystem.JXC.IDAL;

namespace CFSystem.JXC.BasisInfo
{
    public partial class FrmStorageTransaction : Form
    {
        public FrmStorageTransaction()
        {
            InitializeComponent();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            FrmStorageTransReasonSetting FrmStorTransReason = new FrmStorageTransReasonSetting();
            FrmStorTransReason.StartPosition = FormStartPosition.CenterParent;
            FrmStorTransReason.ShowDialog();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FrmStorageTransactionDetailsEdit frmedit = new FrmStorageTransactionDetailsEdit();
            frmedit.StartPosition = FormStartPosition.CenterParent;
            frmedit.ShowDialog();
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FrmStorageTransactionDetailsEdit frmedit = new FrmStorageTransactionDetailsEdit();
            frmedit.StartPosition = FormStartPosition.CenterParent;
            frmedit.ShowDialog();
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            ITransaction its = new InvTransInfo();
            its.DelInvTransRecordByID(Convert.ToInt32(dgvInvChange.SelectedRows[0].Cells[0].Value));
        }
         /// <summary>
         /// 
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
        private void FrmStorageTransaction_Load(object sender, EventArgs e)
        {
            PopulateDgvData();
        }

        /// <summary>
        /// 
        /// </summary>
        private void PopulateDgvData()
        {
            ITransaction its = new InvTransInfo();
            IList<InvTransactionData> iits = its.GetInvTransHistoryInfo();

            dgvInvChange.DataSource = iits;
        }
    }
}
